package behavioral.observer.pull;

import java.util.ArrayList;
import java.util.List;

public abstract class ISubject {

    private List<IObserver> list = new ArrayList<IObserver>();

    public void attach(IObserver observer) {
        if (observer != null) {
            list.add(observer);
        }
    }

    public void remove(IObserver observer) {
        list.remove(observer);
    }

    public void notifyAll1() {
        if (list.size() > 0) {
            for (IObserver observer : list) {
                observer.update(this);
            }
        }
    }

}
